package view.render.weapon
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	
	import model.vo.weapon.GunLanceGunVo;
	
	import view.render.BaseScrollerItem;
	
	
	/**
	 * 铳枪炮击性能列表item
	 * @author £iang
	 * 
	 */	
	public class GunLanceGunItem extends BaseScrollerItem
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 装填数信息 */
		public var loadNumLabel:Label;
		/** 射程信息 */
		public var distanceLabel:Label;
		/** 射角信息 */
		public var rangeLabel:Label;
		/** 单发Lv1信息 */
		public var singePower1Label:Label;
		/** 单发Lv2信息 */
		public var singePower2Label:Label;
		/** 单发Lv3信息 */
		public var singePower3Label:Label;
		/** 单发Lv4信息 */
		public var singePower4Label:Label;
		/** 单发Lv5信息 */
		public var singePower5Label:Label;
		/** 单发耗斩信息 */
		public var singleExpendLabel:Label;
		/** 蓄力炮倍率信息 */
		public var singleChargeLabel:Label;
		/** 全弹倍率信息 */
		public var fullBusterLabel:Label;
		/** 龙击炮Lv1信息 */
		public var cannonPower1Label:Label;
		/** 龙击炮Lv2信息 */
		public var cannonPower2Label:Label;
		/** 龙击炮Lv3信息 */
		public var cannonPower3Label:Label;
		/** 龙击炮Lv4信息 */
		public var cannonPower4Label:Label;
		/** 龙击炮Lv5信息 */
		public var cannonPower5Label:Label;
		/** 龙击炮耗斩信息 */
		public var cannonExpendLabel:Label;
		/** 龙击炮倍率信息 */
		public var cannonRatioLabel:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initializeOther():void
		{
			super.initializeOther();
			loadNumLabel = new Label();
			scollerContainer.addChild( loadNumLabel );
			
			distanceLabel = new Label();
			scollerContainer.addChild( distanceLabel );
			
			rangeLabel = new Label();
			scollerContainer.addChild( rangeLabel );
			
			singePower1Label = new Label();
			scollerContainer.addChild( singePower1Label );
			
			singePower2Label = new Label();
			scollerContainer.addChild( singePower2Label );
			
			singePower3Label = new Label();
			scollerContainer.addChild( singePower3Label );
			
			singePower4Label = new Label();
			scollerContainer.addChild( singePower4Label );
			
			singePower5Label = new Label();
			scollerContainer.addChild( singePower5Label );
			
			singleExpendLabel = new Label();
			scollerContainer.addChild( singleExpendLabel );
			
			singleChargeLabel = new Label();
			scollerContainer.addChild( singleChargeLabel );
			
			fullBusterLabel = new Label();
			scollerContainer.addChild( fullBusterLabel );
			
			cannonPower1Label = new Label();
			scollerContainer.addChild( cannonPower1Label );
			
			cannonPower2Label = new Label();
			scollerContainer.addChild( cannonPower2Label );
			
			cannonPower3Label = new Label();
			scollerContainer.addChild( cannonPower3Label );
			
			cannonPower4Label = new Label();
			scollerContainer.addChild( cannonPower4Label );
			
			cannonPower5Label = new Label();
			scollerContainer.addChild( cannonPower5Label );
			
			cannonExpendLabel = new Label();
			scollerContainer.addChild( cannonExpendLabel );
			
			cannonRatioLabel = new Label();
			scollerContainer.addChild( cannonRatioLabel );
		}
		
		/**
		 * 调整组件 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( _itemH - 
				43 ) / 2 * UISize.DPI_SCALE;
			var padding:Number = UISize.TITLE_PADDING_LEFT * UISize.DPI_SCALE;
			var firstLabelFullW:Number;
			
			firstLabel.x = padding;
			firstLabelFullW = UISize.MAIN_W * _firstPercent;
			
			loadNumLabel.y = labelY;
			loadNumLabel.x = 0;
			loadNumLabel.width  = UISize.MAIN_W * 0.3;
			
			distanceLabel.y = labelY;
			distanceLabel.x = UISize.MAIN_W * 0.3;
			distanceLabel.width  = UISize.MAIN_W * 0.2;
			
			rangeLabel.y = labelY;
			rangeLabel.x = UISize.MAIN_W * 0.5;
			rangeLabel.width  = UISize.MAIN_W * 0.2;
			
			singePower1Label.y = labelY;
			singePower1Label.x = UISize.MAIN_W * 0.7;
			singePower1Label.width  = UISize.MAIN_W * 0.35;
			
			singePower2Label.y = labelY;
			singePower2Label.x = UISize.MAIN_W * 1.05;
			singePower2Label.width  = UISize.MAIN_W * 0.35;
			
			singePower3Label.y = labelY;
			singePower3Label.x = UISize.MAIN_W * 1.4;
			singePower3Label.width  = UISize.MAIN_W * 0.35;
			
			singePower4Label.y = labelY;
			singePower4Label.x = UISize.MAIN_W * 1.75;
			singePower4Label.width  = UISize.MAIN_W * 0.35;
			
			singePower5Label.y = labelY;
			singePower5Label.x = UISize.MAIN_W * 2.1;
			singePower5Label.width  = UISize.MAIN_W * 0.35;
			
			singleExpendLabel.y = labelY;
			singleExpendLabel.x = UISize.MAIN_W * 2.45;
			singleExpendLabel.width  = UISize.MAIN_W * 0.35;
			
			singleChargeLabel.y = labelY;
			singleChargeLabel.x = UISize.MAIN_W * 2.8;
			singleChargeLabel.width  = UISize.MAIN_W * 0.35;
			
			fullBusterLabel.y = labelY;
			fullBusterLabel.x = UISize.MAIN_W * 3.15;
			fullBusterLabel.width  = UISize.MAIN_W * 0.35;
			
			cannonPower1Label.y = labelY;
			cannonPower1Label.x = UISize.MAIN_W * 3.5;
			cannonPower1Label.width  = UISize.MAIN_W * 0.35;
			
			cannonPower2Label.y = labelY;
			cannonPower2Label.x = UISize.MAIN_W * 3.85;
			cannonPower2Label.width  = UISize.MAIN_W * 0.35;
			
			cannonPower3Label.y = labelY;
			cannonPower3Label.x = UISize.MAIN_W * 4.2;
			cannonPower3Label.width  = UISize.MAIN_W * 0.35;
			
			cannonPower4Label.y = labelY;
			cannonPower4Label.x = UISize.MAIN_W * 4.55;
			cannonPower4Label.width  = UISize.MAIN_W * 0.35;
			
			cannonPower5Label.y = labelY;
			cannonPower5Label.x = UISize.MAIN_W * 4.9;
			cannonPower5Label.width  = UISize.MAIN_W * 0.35;
			
			cannonExpendLabel.y = labelY;
			cannonExpendLabel.x = UISize.MAIN_W * 5.25;
			cannonExpendLabel.width  = UISize.MAIN_W * 0.35;
			
			cannonRatioLabel.y = labelY;
			cannonRatioLabel.x = UISize.MAIN_W * 5.6;
			cannonRatioLabel.width  = UISize.MAIN_W * 0.35;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.height = _itemH * UISize.DPI_SCALE;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			
			this.width = UISize.MAIN_W;
			this.height = _itemH * UISize.DPI_SCALE;
		}
		
		/**
		 * 设置item数据 
		 * @param data 数据
		 * 
		 */		
		public function setData( data:GunLanceGunVo ):void
		{
			firstLabel.text = data.type;
			loadNumLabel.text = data.loadNum;
			distanceLabel.text = data.distance;
			rangeLabel.text = data.range;
			singePower1Label.text = data.singePower1;
			singePower2Label.text = data.singePower2;
			singePower3Label.text = data.singePower3;
			singePower4Label.text = data.singePower4;
			singePower5Label.text = data.singePower5;
			singleExpendLabel.text = data.singleExpend;
			singleChargeLabel.text = data.singleCharge;
			fullBusterLabel.text = data.fullBuster;
			cannonPower1Label.text = data.cannonPower1;
			cannonPower2Label.text = data.cannonPower2;
			cannonPower3Label.text = data.cannonPower3;
			cannonPower4Label.text = data.cannonPower4;
			cannonPower5Label.text = data.cannonPower5;
			cannonExpendLabel.text = data.cannonExpend;
			cannonRatioLabel.text = data.cannonRatio;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构滚动条容器中的标签 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"loadNum", "distance",
				"range", "singePower1",
				"singePower2", "singePower3",
				"singePower4", "singePower5",
				"singleExpend", "singleCharge",
				"fullBuster", "cannonPower1",
				"cannonPower2", "cannonPower3",
				"cannonPower4", "cannonPower5",
				"cannonExpend", "cannonRatio"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function GunLanceGunItem()
		{
			super();
			_itemH = UISize.GREAT_SWORD_MOTION_ITEM_H;
			_firstPercent = 0.3;
			initialize();
		}
	}
}